package core.command
{
	import core.event.SocketEventID;
	import core.event.UnoEvent;
	import core.event.ViewEventID;
	
	public class JoinTableUpdateCommand extends SuperCommand
	{
		public function JoinTableUpdateCommand()
		{
			socketEvent = SocketEventID.JOIN_TABLE_UPDATE;
			viewEvent = ViewEventID.JOIN_TABLE_UPDATE;
		}
		
		override public function success(e:UnoEvent):void
		{
			if(db.tableList.hasOwnProperty(e.data.tableID))
			{
				db.tableList[e.data.tableID].userList[e.data.seat.seatID] = e.data.seat;
			}
		
			db.userList[e.data.seat.userID].seatID = e.data.seat.seatID;
			db.userList[e.data.seat.userID].tableID = e.data.tableID;
		}
	}
}